import java.util.*;

public class AntsMeet {
	
	
	
	private int intersect (int x1, int y1, int dir1, int x2, int y2, int dir2) {
		if (dir1 == dir2) return -1;
		if (dir1 + dir2 == 0) {
			if (Math.abs(dir1) == 1) {
				if (x1 != x2) return -1;
				if (2*(y1 - y2)/(dir1-dir2) > 0) return -1;
				return Math.abs(y1-y2);
			} else {
				if (y1 != y2) return -1;
				if (4*(x1 - x2)/(dir1-dir2) > 0) return -1;
				return Math.abs(x1-x2);				
			}
		} else {
			if (x1 == x2 || y1 == y2) return -1;
			
			if (Math.abs(dir1) == 1) {
				int yd = (y2 - y1) / dir1;
				if (yd < 0) return -1;
				
				int xd = (x1 - x2) / (dir2/2);
				if (xd < 0) return -1;
				
				if (yd != xd) return -1;
				return yd*2;
			} else {
				int yd = (y1 - y2) / dir2;
				if (yd < 0) return -1;
				
				int xd = (x2 - x1) / (dir1/2);
				if (xd < 0) return -1;
				
				if (yd != xd) return -1;
				return yd*2;
			}
		}
	}
	
	private int convert(char c) {
		switch (c) {
		case 'N':
			return 1;
		case 'S':
			return -1;
		case 'E':
			return 2;
		case 'W':
			return -2;
		default:
			return 0;
		}
	}

	class Dist implements Comparable <Dist> {
		int x;
		int y;
		int dist;
		public int compareTo(Dist o) {
			if (dist > o.dist) return 1;
			else if (dist < o.dist) return -1;
			else return 0;
		}
		public Dist(int x, int y, int dist) {
			super();
			this.x = x;
			this.y = y;
			this.dist = dist;
		}		
		
		
	}
	
	public int countAnts(int[] x, int[] y, String direction) {
		ArrayList<Dist> list = new ArrayList<Dist>();
		for (int i=0; i<x.length; i++) {
			for (int j=0; j<x.length; j++) {
				if (i != j) {
					int dist = intersect(x[i], y[i], convert(direction.charAt(i)), x[j], y[j], convert(direction.charAt(j)));
					if (dist >= 0) {
						list.add(new Dist(i, j, dist));
					}
				}
			}			
		}
		
		Collections.sort(list);
		boolean[] marked = new boolean[x.length];
		for (int i=0; i<list.size();) {
			boolean[] nmarked = (boolean[])marked.clone();
			int j = i;
			for (; j < list.size() && (list.get(i).dist == list.get(j).dist); j++) {
				if (!(marked[list.get(j).x] || marked[list.get(j).y])) {
					nmarked[list.get(j).x] = true;
					nmarked[list.get(j).y] = true;
				}
			}
			marked = nmarked;
			i = j;
		}
		int res = 0;
		for (int i=0; i<marked.length; i++) if (!marked[i]) res++;
		return res;
	}

}
